<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jstl/core" 
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:dynamic="http://www.topikachu.net/dynamic"	
	template="layout/template.xhtml"
	>
	
	<ui:define name="body">

		<h:form id="dynamicEntityForm">
	
			<rich:panel>
				<f:facet name="header">dynamicEntity</f:facet>
				<h:outputText value="${dynamicEntityHome.entityName}" />
				<s:decorate id="nameField" template="layout/edit.xhtml">
					<ui:define name="label">Name</ui:define>
					<h:inputText id="name" required="true"
						value="#{dynamicEntityHome.instance.name}" />
				</s:decorate>

				<div style="clear: both" />

			</rich:panel>

			<div class="actionButtons">
			<a4j:commandButton id="save"
				value="Save" action="#{dynamicEntityHome.persist}"
				rendered="#{!dynamicEntityHome.managed}"  reRender="body" >
				<a4j:actionparam name="entityName" value="#{dynamicEntityHome.entityName}"/>
			</a4j:commandButton>
			
			 <a4j:commandButton id="update" value="Save"
				action="#{dynamicEntityHome.update}"
				rendered="#{dynamicEntityHome.managed}"  reRender="body" >
				<a4j:actionparam name="entityName" value="#{dynamicEntityHome.entityName}"/>
			</a4j:commandButton>

			<a4j:commandButton id="delete" value="Delete"
				action="#{dynamicEntityHome.remove}" immediate="true"
				rendered="#{dynamicEntityHome.managed}"  reRender="body" >
				<a4j:actionparam name="entityName" value="#{dynamicEntityHome.entityName}"/>
			</a4j:commandButton>

			<s:button propagation="end" id="cancel" value="Cancel"
				view="/list.xhtml">
				<f:param name="entityName" value="#{dynamicEntityHome.entityName}" />
			</s:button>
			</div>
			
			<dynamic:screen widget="#{detailScreen.widget}" entity="#{dynamicEntityHome.instance}"/>
			
		</h:form>
		  
	</ui:define>

</ui:composition>
